class UserServices {
  constructor() {
    // 初始化代码
  }

  async getAllUsers(sort) {
    let order = [];
    if (sort) {
      const [field, direction] = sort.split(':');
      order = [[field, direction.toUpperCase()]];
    }

    const users = await User.findAll({
      order,
      attributes: ['id', 'nick_name', 'avatar_url', 'is_active', 'created_at']
    });

    return users;
  }
}

module.exports = UserServices;
